/*  
	------------------------------------------------------------------------
	 NQ Core Library
	
	 Homepage: http://www.awzhome.de/
	------------------------------------------------------------------------
	
	This Source Code Form is subject to the terms of the Mozilla Public
	License, v. 2.0. If a copy of the MPL was not distributed with this
	file, You can obtain one at http://mozilla.org/MPL/2.0/.
   
	The Original Code is code of NQ Core Library.

	The Initial Developer of the Original Code is Andreas Weizel.
	Portions created by the Initial Developer are
	Copyright (C) 2012 Andreas Weizel. All Rights Reserved.
	
	Contributor(s): (none)
	
	------------------------------------------------------------------------
*/

namespace AWZhome.NQ.Core
{

	/// <summary>
	/// Interface for a service that holds a collection of other service instances.
	/// </summary>
	/// <typeparam name="K">Type of the key used to identify collection items.</typeparam>
	/// <typeparam name="V">
	/// Type of the service instances in the collection.
	/// </typeparam>
	/// <remarks>
	/// This interface can be used to create services that have to manage another services.
	/// As it implements the <see cref="System.Collections.Generic.IEnumerable{V}">IEnumerable&lt;&gt;</see>
	/// interface, the service object can be used like any other collection, for example in 
	/// <c>foreach</c> (C#, <c>For Each</c> in VB) constructs.
	/// </remarks>
	public interface INQCollectionService<K, V> : System.Collections.Generic.IEnumerable<V>
	{
		/// <summary>
		/// Indexer to retrieve a service instance using a key.
		/// </summary>
		/// <param name="key">Item key.</param>
		/// <returns></returns>
		V this[K key]
		{
			get;
		}

		/// <summary>
		/// Returns the number of service instances managed by the collection service.
		/// </summary>
		int Count
		{
			get;
		}
	}
}